Adds or replaces an item in the collection, returns true if any item was replaced
Syntax
Example
Library/Library.Test/TestSetList.cs
C# | Copy Code |
---|
MyValue one = new MyValue(1);
MyValue two = new MyValue(2);
SetList<MyValue> set = new SetList<MyValue>();
set.Add(one);
set.Add(two);
Assert.AreEqual(2, set.Count);
Assert.IsTrue(Object.ReferenceEquals(one, set[0]));
Assert.IsTrue(set.ReplaceAll(new MyValue[] { new MyValue(1), new MyValue(3) }));
Assert.IsFalse(Object.ReferenceEquals(one, set[0]));
Assert.AreEqual(3, set.Count); |
VB.NET | Copy Code |
---|
Dim one As New MyValue(1)
Dim two As New MyValue(2)
Dim [set] As New SetList(Of MyValue)()
[set].Add(one)
[set].Add(two)
Assert.AreEqual(2, [set].Count)
Assert.IsTrue([Object].ReferenceEquals(one, [set](0)))
Assert.IsTrue([set].ReplaceAll(New MyValue() {New MyValue(1), New MyValue(3)}))
Assert.IsFalse([Object].ReferenceEquals(one, [set](0)))
Assert.AreEqual(3, [set].Count) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also